//
//  UITableView+LZTableView.m
//  laziz_Consumer
//
//  Created by xbn_iMac on 2016/12/28.
//  Copyright © 2016年 XBN. All rights reserved.
//

#import "UITableView+LZTableView.h"
#import "MJRefreshAutoNormalFooter.h"
#import "MJRefreshNormalHeader.h"

@implementation UITableView (LZTableView)

- (void)configHeaderRefreshText {
    MJRefreshNormalHeader *header = (MJRefreshNormalHeader*)self.mj_header;
    // 设置自动切换透明度(在导航栏下面自动隐藏)
    header.automaticallyChangeAlpha = YES;
    // 隐藏时间
    header.lastUpdatedTimeLabel.hidden = YES;
    
    header.stateLabel.textColor = UIColorFromRGB(0x999999, 1);
    header.stateLabel.font = [UIFont systemFontOfSize:13];
    
    // 设置文字
    [header setTitle:LZLocalizedString(@"refresh_header_pull_down", nil) forState:MJRefreshStateIdle];
    [header setTitle:LZLocalizedString(@"refresh_header_release_to_refresh", nil) forState:MJRefreshStatePulling];
    [header setTitle:LZLocalizedString(@"refresh_loading", nil) forState:MJRefreshStateRefreshing];
    
}

- (void)configFooterRefreshText {
    MJRefreshAutoNormalFooter *footer = (MJRefreshAutoNormalFooter*)self.mj_footer;
    [footer setTitle:LZLocalizedString(@"refresh_footer_pull_up", nil) forState:MJRefreshStateIdle];
    [footer setTitle:LZLocalizedString(@"refresh_loading", nil) forState:MJRefreshStateRefreshing];
    footer.stateLabel.textColor = UIColorFromRGB(0x999999, 1);
    footer.stateLabel.font = [UIFont systemFontOfSize:13];
}

- (void)setNoDataFooterText {
    MJRefreshAutoNormalFooter *footer = (MJRefreshAutoNormalFooter*)self.mj_footer;
    [footer setTitle:LZLocalizedString(@"refresh_footer_no_data", nil) forState:MJRefreshStateNoMoreData];
    footer.stateLabel.textColor = UIColorFromRGB(0x999999, 1);
    footer.stateLabel.font = [UIFont systemFontOfSize:13];
}

- (void)setNullStringFooterText {
    MJRefreshAutoNormalFooter *footer = (MJRefreshAutoNormalFooter*)self.mj_footer;
    [footer setTitle:@"" forState:MJRefreshStateNoMoreData];
}

- (void)setNoMoreDataFooterText {
    MJRefreshAutoNormalFooter *footer = (MJRefreshAutoNormalFooter*)self.mj_footer;
    [footer setTitle:LZLocalizedString(@"refresh_footer_no_more_data", nil) forState:MJRefreshStateNoMoreData];
    footer.stateLabel.textColor = UIColorFromRGB(0x999999, 1);
    footer.stateLabel.font = [UIFont systemFontOfSize:13];
}

@end
